package com.ibeeking.found.msg.rest.controller.v1.feign;

import com.ibeeking.found.common.db.annotation.Read;
import com.ibeeking.found.msg.api.common.query.SubscribeQuery;
import com.ibeeking.found.msg.rest.service.IWxMpFansService;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName MpFansController控制器
 * @Description
 * @Author ibeeking
 * @Date 2020-12-30 14:12
 **/
@RestController
@RequestMapping("/b/mpFans/feign/v1")
public class MpFansFeignController {

    @Resource
    private IWxMpFansService mpFansServiceImpl;

    @Read
    @Log(logType = OperateLogTypeEnum.QUERY, describe = "查询关注/未关注OpenId")
    @PostMapping(value = "/subscribeQuery")
    public List<String> subscribeQuery(@RequestBody SubscribeQuery query) {
        return mpFansServiceImpl.subscribeQuery(query);
    }

    @Read
    @Log(logType = OperateLogTypeEnum.QUERY, describe = "通过unionid查询openid")
    @PostMapping(value = "/queryOpenIds")
    public List<String> queryOpenIds(@RequestBody List<String> unionIds) {
        return mpFansServiceImpl.queryOpenIds(unionIds);
    }
}
